<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style>
        * {
            margin:0;
            padding:0;
        }
        table {
            width:450px;
            margin:0 auto;
        }
        th {
            font-size:20px;
        }
        td {
            padding-bottom:10px;
        }
    </style>
</head>
<body>
    <form id="form1" method="post" runat="server">
        <table>
            <tr>
                <th>注&nbsp;&nbsp;&nbsp;&nbsp;册</th>
                <th></th>
            </tr>

            <tr>
                <td>姓名：</td>
                <td>
                    <asp:TextBox ID="tbxUserName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="账号不能为空！" ControlToValidate="tbxUserName" Display="Dynamic" Font-Bold="True" Font-Size="Large"></asp:RequiredFieldValidator>
                    <asp:CustomValidator ID="CustomValidator1" ControlToValidate="tbxUserName" runat="server" ErrorMessage="账号不能为admin" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
                </td>
            </tr>

            <tr>
                <td>密码：</td>
                <td>
                    <asp:TextBox ID="tbxPassword" TextMode="Password" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvPassword" runat="server" Display="Dynamic" ControlToValidate="tbxPassword" ErrorMessage="密码不能为空" Font-Bold="True"></asp:RequiredFieldValidator>
                </td>
            </tr>

            <tr>
                <td>确认密码：</td>
                <td>
                    <asp:TextBox ID="tbxPassWord2" TextMode="Password" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"  ErrorMessage="确认密码不能为空" ControlToValidate="tbxPassWord2"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator1" Display="Dynamic" runat="server" ErrorMessage="两次密码不一致" ControlToValidate="tbxPassWord2" ControlToCompare="tbxPassword"></asp:CompareValidator>
                </td>
            </tr>

            <tr>
                <td>年龄：</td>
                <td>
                    <asp:TextBox ID="tbxAge" runat="server"></asp:TextBox>
                    <asp:RangeValidator ID="RangeValidator1" MaximumValue="200" MinimumValue="0" runat="server" ControlToValidate="tbxAge" ErrorMessage="年龄超出范围，应在0~200" Type="Double"></asp:RangeValidator>
                </td>
            </tr>

            <tr>
                <td>出生日期：</td>
                <td>
                    <asp:TextBox ID="tbxBirth" runat="server"></asp:TextBox> 
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="tbxBirth" Display="Dynamic"
                        runat="server" ErrorMessage="日期格式不正确，正确格式：2000-01-01" ValidationExpression="^[1-2]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$"></asp:RegularExpressionValidator>
                    <asp:RangeValidator ID="RangeValidator2" ControlToValidate="tbxBirth" runat="server" 
                        Display="Dynamic" Type="Date" MinimumValue="1900-01-01" ErrorMessage="日期超出范围"></asp:RangeValidator>
                </td>
            </tr>

            <tr>
                <td>毕业时间：</td>
                <td>
                    <asp:TextBox ID="tbxGraduate" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" ControlToValidate="tbxGraduate" Display="Dynamic"
                        runat="server" ErrorMessage="日期格式不正确，正确格式：2000-01-01" ValidationExpression="^[1-2]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$"></asp:RegularExpressionValidator>
                    <asp:CompareValidator Display="Dynamic" ID="CompareValidator2" ControlToValidate="tbxGraduate" runat="server" ErrorMessage="不能早于出生日期"
                         ControlToCompare="tbxBirth" Operator="GreaterThan" Type="Date"></asp:CompareValidator>
                    <asp:RangeValidator ID="RangeValidator3" ControlToValidate="tbxGraduate" runat="server" 
                        Display="Dynamic" Type="Date" MinimumValue="1900-01-01" ErrorMessage="日期超出范围"></asp:RangeValidator>
                </td>
            </tr>

            <tr>
                <td>邮箱：</td>
                <td>
                    <asp:TextBox ID="tbxEmail" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" ControlToValidate="tbxEmail" runat="server" ErrorMessage="邮箱格式不正确" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </td>
            </tr>

            <tr>
                <td>
                    <asp:Button ID="btnCommit" runat="server" Text="提交" OnClick="btnCommit_Click" />
                </td>
                <td></td>
            </tr>

            <tr>
                <td colspan="2">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="SingleParagraph" ShowMessageBox="True" />
                </td>
            </tr>

             <tr>
                <td colspan="2">
                    <asp:Label ID="Literal1" runat="server" Text=""></asp:Label>
                </td>
            </tr>

        </table>
    </form>
</body>
</html>
